case class Camera(
  lookfrom: Vec3, lookat: Vec3, vup: Vec3,
  vfov: Double, aspect_ratio: Double,
  aperture: Double, focus_dist: Double
):
  val theta = degrees_to_radians(vfov)
  val h = math.tan(theta / 2.0)
  val viewport_height = 2.0 * h
  val viewport_width = aspect_ratio * viewport_height

  val w = (lookfrom - lookat).unit_vector
  val u = cross(vup, w).unit_vector
  val v = cross(w, u)

  val origin = lookfrom
  val horizontal = u * viewport_width * focus_dist 
  val vertical = v * viewport_height * focus_dist 
  val lower_left_corner = origin - horizontal / 2 - vertical / 2 - w * focus_dist 
  val lens_radius = aperture / 2

  def get_ray(s: Double, t: Double): Ray =
    val rd = Vec3.random_in_unit_disk * lens_radius
    val offset =  u * rd.x +  v * rd.y
    Ray(
      origin + offset,
      lower_left_corner + horizontal * s + vertical * t - origin - offset
    )

  
